import 'dart:async';

import 'package:flutter/services.dart';

class PolyvVideoPlugin {
  static const _channel = MethodChannel('plugins.polyv/util');

  ///点播SDK初始化 建议开发阶段使用
  static Future<String> playerConfig({
    required String config,

    ///加密串
    required String aesKey,

    ///加密秘钥
    required String iv,

    ///加密向量
  }) async {
    return await _channel.invokeMethod('playerConfig', {
      "config": config,
      "aesKey": aesKey,
      "iv": iv,
    });
  }

  ///点播SDK初始化 正式环境使用
  ///保利威点播账号配置，加解密点播视频用，必须配置后才可使用播放器播放
  static Future<bool> accountConfig({
    required String userID,
    required String secretKey,
    required String readToken,
    required String writeToken,
  }) async {
    return await _channel.invokeMethod('accountConfig', {
      "userID": userID,
      "secretKey": secretKey,
      "readToken": readToken,
      "writeToken": writeToken,
    });
  }
}